package com.example.ivory.accountbook.Activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.Switch;
import android.widget.Toast;

import com.example.ivory.accountbook.R;
import com.example.ivory.accountbook.uilt.TittleManager;

/**
 * Created by Ivory on 2016/8/27.
 */
public class Alert extends AppCompatActivity implements View.OnClickListener {

    private Button creditCard,houseRent=null;
    private Switch turn_on;
    private boolean key=false;
    private TittleManager tittleManager;

    public void initView(){

        turn_on=(Switch)findViewById(R.id.turn_on);
        creditCard=(Button)findViewById(R.id.creditCard);
        houseRent=(Button)findViewById(R.id.houseRent);

    }
    public void initEvents(){
        turn_on.setOnClickListener(this);
        creditCard.setOnClickListener(this);
        houseRent.setOnClickListener(this);



    }

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_alert);
        tittleManager=new TittleManager(this);
        tittleManager.setTitleStyle(TittleManager.TitleStyle.ONLY_BACK,"提醒");
        initView();
        initEvents();
    }





    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.turn_on:
                if(key==false) {
                    key=true;
                    Toast.makeText(Alert.this,"开启提醒功能",Toast.LENGTH_LONG).show();
                }else {
                    key = false;
                    Toast.makeText(Alert.this, "关闭提醒功能", Toast.LENGTH_LONG).show();
                }
                break;
            case R.id.creditCard:
                Toast.makeText(Alert.this,"设置信用卡提醒",Toast.LENGTH_LONG).show();
                break;
            case R.id.houseRent:
                Toast.makeText(Alert.this,"设置房租提醒",Toast.LENGTH_LONG).show();
                break;

        }
    }
}
